﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace xx
{
	/// <summary>
    /// 
    /// </summary>
	public class CoroutineDemo02 : MonoBehaviour {
        //执行顺序：afcge...bd
        Coroutine cor;
        private void Start()
        {
            print("a::" + Time.frameCount);
            cor = StartCoroutine(Test01());
            print("c::" + Time.frameCount);
            StartCoroutine(Test02());
            print("e::" + Time.frameCount);
        }
        private IEnumerator Test01()
        {
            print("f::" + Time.frameCount);
            yield return new WaitForSeconds(2);//等待2秒
            print("b::" + Time.frameCount);
        }
        private IEnumerator Test02()
        {
            print("g::" + Time.frameCount);
            yield return cor;
            print("d::" + Time.frameCount);
        }
        //练习：物体巡逻
        //多点间移动
    }
}

